var SCRIBEFIRE_SETTINGS = {
    init : function () {
    },
    
    accept : function () {
        if (!document.getElementById("scribefire-settings-window").instantApply) {
            var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("");
            
            // Apply all of the preference changes.
            var preferences = document.getElementsByTagName("preference");
            
            for (var i = 0; i < preferences.length; i++) {
                var pref = preferences[i];
                var val = pref.value;
                var name = pref.getAttribute("name");
                
                switch (pref.getAttribute("type")) {
                    case 'int':
                        prefs.setIntPref(name, val);
                    break;
                    case 'unichar':
                        var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
            		    str.data = val;
            		    prefs.setComplexValue(name, Components.interfaces.nsISupportsString, str);
                    break;
                    case 'bool':
                        prefs.setBoolPref(name, val);
                    break;
                }
            }
		}
		
		return true;
    }
};